package com.nulldev.util.web.nTube.pages.ntv;

import com.nulldev.util.languages.json.uniapi.UniJsonValue;
import com.nulldev.util.manage.MarkedForRemoval;
import com.nulldev.util.web.HttpServer3.Response;
import com.nulldev.util.web.HttpServer3.pages.v3.HttpPage3;
import com.nulldev.util.web.nTubeExtensions.services.TwitchTV;

@MarkedForRemoval(reason = "nTV is no more.")
public class NTVGetMetaPage extends HttpPage3 {

	public NTVGetMetaPage() {
		super("/ntv/get_meta");
	}

	@SuppressWarnings("resource")
	@Override
	public Response onRequest(final Request request) {
		if (NTVGetPage.ttv.isNull()) {
			NTVGetPage.ttv.setObject(new TwitchTV());
		}
		final UniJsonValue uv = UniJsonValue.object().add("reason", "nTV is no longer available.").add("error", true);
		return new Response(403, uv, uv).setCustomMime("application/json");
//		final Map<String, String> s = URLUtils.parseQuery(URLUtils.parseURL(request.url()));
//		final UniJsonValue jso = UniJsonValue.object();
//		if (!s.containsKey("channel")) {
//			jso.add("error", "No channel provided!");
//			return new Response(200, jso).setCustomMime("application/json");
//		}
//		final String channel = s.get("channel");
//		jso.add("channelName", channel);
//		jso.add("meta", NTVGetPage.ttv.getObject().accquire(channel).get());
//		return new Response(200, jso).setCustomMime("application/json");
	}

}
